package com.palm.web.util;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;

import com.palm.dao.entity.Location;

public class DataPool {

	private static DataPool dataPool = new DataPool();

	private LinkedBlockingDeque<Location> locations;

	public static DataPool Instance() {
		return dataPool;
	}

	private DataPool() {
		locations = new LinkedBlockingDeque<Location>();
	}

	public Location get() {
		try {
			return locations.pollFirst();
		} catch (Exception e) {
			e.printStackTrace();
			return null;

		}
	}

	public void add(Location location) {
		locations.addLast(location);
	}
}
